import type { CardDetail, CardListData, CardListParams, CardParams } from "@/types/card"
import { request } from "@/utils/reuqest"


export const getCardLsitAPI = (params: CardListParams) => {
  return request<CardListData>('parking/card/list','get', params)
} 

// 添加月卡
export const createCardAPI = (params: Partial<CardParams>) => {
  return request('parking/card','post', params)
}

/**
 * 获取月卡详情
 * @param {*} id
 * @returns
 */
export const getCardDetailAPI = (id:string) =>{
  return request<CardDetail>(`/parking/card/detail/${id}`,'get')
}

/**
 * 更新月卡
 * @param {*} data
 * @returns
 */
export const updateCardAPI = (data: Partial<CardDetail>) => {
  return request('/parking/card/edit', 'PUT', data)
}

/**
 * 删除月卡
 * @param {*} id
 * @returns
 */
export const delCardAPI = (ids: number[]) => {
  return request(`/parking/card/${ids.join(',')}`, 'DELETE')
}